home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr10 / inter35c.zip / WINHELP.ZIP / BY2RTF.AWK < prev    next >
Text File  |  1993-01-31  |  2KB  |  54 lines

  1.  
  2.  
  3. BEGIN{
  4.   printf("{\\rtf\n")
  5.   printf("{\\fonttbl\n")
  6.   printf("\\f0\\froman Times New Roman;\n")
  7.   printf("\\f1\\fdecor Courier New;\n")
  8.   printf("\\f3\\fswiss Arial;\n")
  9. # printf("\\f4\\fnil Monospaced;}\n")
  10.   printf("\\f4\\fmodern Terminal;}\n")
  11.   printf("\\deff3\n")
  12.   printf("\\deftab1440")
  13.   count = 00002
  14. # 2 so that hc reports same topic numbers
  15.   col = 2
  16. # first line will be first column
  17. # chance maxcol to desired number of columns
  18.   maxcol = 4
  19.   lineend = ""
  20.  
  21. }
  22. {
  23. line = $0
  24.  
  25. if ($1 ~ /.freeze/) { next; };
  26.  
  27. if ($1 ~ /\\i\\p\\aUp/) { next };
  28.  
  29. if ($1 ~ /--/) { next };
  30.  
  31. if ($1 ~ /───/) { next };
  32.  
  33. if ($1 ~ /.context/) { sub("@IL", "_IL", $2); printf("\\pard\\page\n#{\\footnote _%sZ }\n+{\\footnote %s:%-5.5d}\n", $2, lev, count++); next };
  34.  
  35. if ($1 ~ /.topic/) { printf("${\\footnote %-4.4d%s}\nK{\\footnote %s}\n\\par{\\f3\\fs28\\b%s}\n\\par \\tx1440\\tx2880\\tx4320 ", count, prefix, substr($0,7), substr($0,7) ); first = 2; col = 1; next };
  36. # The line below produces produces intelligible titles but file size grows and
  37. # hc must run in OS/2 because of memory requirements
  38. # if ($1 ~ /.topic/) { printf("${\\footnote %s%s}\nK{\\footnote %s}\n\\par{\\f3\\fs28\\b%s}\\n\\par\\tx1440\\tx2880\\tx4320", substr($0,7), prefix, substr($0,7), substr($0,7) ); first= 2; col = 1; next };
  39.  
  40. gsub("\\\\a", "{\\uldb ", line);
  41. gsub("\\\\v$",    "Z}"      , line);
  42. gsub("\\\\v",    " }{\\v _"      , line);
  43. gsub("@IL", "_IL", line);
  44. if ((first > 0) && (prefix == "V") && (length(line) > 1)) {sub("\t", "", line); }
  45. first--;
  46. if (prefix == "V") sub("\t", "\\tab ", line);
  47. gsub("\t", "", line);
  48. if (prefix == "F")  lineend = "\par"
  49. if ((prefix == "V") && (col > maxcol))  {print line "\par"; col = 2; first = 1 } else {print line lineend; col++}
  50. }
  51. END {
  52.   printf("\\plain \\page\n}\n")
  53. }
  54.